home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / displytl / xvtiff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  11.7 KB  |  231 lines

  1. /* $Header: /Source/Media/collab/DisplayTool/RCS/xvtiff.h,v 1.1 92/09/29 01:06:02 drapeau Exp $ */
  2.  
  3. /*
  4.  * Copyright (c) 1988, 1989, 1990, 1991 Sam Leffler
  5.  * Copyright (c) 1991 Silicon Graphics, Inc.
  6.  *
  7.  * Permission to use, copy, modify, distribute, and sell this software and 
  8.  * its documentation for any purpose is hereby granted without fee, provided
  9.  * that (i) the above copyright notices and this permission notice appear in
  10.  * all copies of the software and related documentation, and (ii) the names of
  11.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  12.  * publicity relating to the software without the specific, prior written
  13.  * permission of Sam Leffler and Silicon Graphics.
  14.  * 
  15.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  16.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  17.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  18.  * 
  19.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  20.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  21.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  24.  * OF THIS SOFTWARE.
  25.  */
  26.  
  27. #ifndef _TIFF_
  28. #define    _TIFF_
  29. /*
  30.  * Tag Image File Format (TIFF)
  31.  *
  32.  * Based on Rev 5.0 from:
  33.  *    Developer's Desk
  34.  *    Aldus Corporation
  35.  *    411 First Ave. South
  36.  *    Suite 200
  37.  *    Seattle, WA  98104
  38.  *    206-622-5500
  39.  */
  40. #define    TIFF_VERSION    42
  41.  
  42. #define    TIFF_BIGENDIAN        0x4d4d
  43. #define    TIFF_LITTLEENDIAN    0x4949
  44.  
  45. typedef    struct {
  46.     unsigned short tiff_magic;    /* magic number (defines byte order) */
  47.     unsigned short tiff_version;    /* TIFF version number */
  48.     unsigned long  tiff_diroff;    /* byte offset to first directory */
  49. } TIFFHeader;
  50.  
  51. /*
  52.  * TIFF Image File Directories are comprised of
  53.  * a table of field descriptors of the form shown
  54.  * below.  The table is sorted in ascending order
  55.  * by tag.  The values associated with each entry
  56.  * are disjoint and may appear anywhere in the file
  57.  * (so long as they are placed on a word boundary).
  58.  *
  59.  * If the value is 4 bytes or less, then it is placed
  60.  * in the offset field to save space.  If the value
  61.  * is less than 4 bytes, it is left-justified in the
  62.  * offset field.
  63.  */
  64. typedef    struct {
  65.     unsigned short tdir_tag;    /* see below */
  66.     unsigned short tdir_type;    /* data type; see below */
  67.     unsigned long  tdir_count;    /* number of items; length in spec */
  68.     unsigned long  tdir_offset;    /* byte offset to field data */
  69. } TIFFDirEntry;
  70.  
  71. typedef    enum {
  72.     TIFF_NOTYPE = 0,    /* placeholder */
  73.     TIFF_BYTE = 1,        /* 8-bit unsigned integer */
  74.     TIFF_ASCII = 2,        /* 8-bit bytes w/ last byte null */
  75.     TIFF_SHORT = 3,        /* 16-bit unsigned integer */
  76.     TIFF_LONG = 4,        /* 32-bit unsigned integer */
  77.     TIFF_RATIONAL = 5    /* 64-bit fractional (numerator+denominator) */
  78. } TIFFDataType;
  79.  
  80. /*
  81.  * TIFF Tag Definitions.
  82.  *
  83.  * Those marked with a + are obsoleted by revision 5.0.
  84.  * Those marked with a ! are proposed for revision 6.0.
  85.  */
  86. #define    TIFFTAG_SUBFILETYPE        254    /* subfile data descriptor */
  87. #define        FILETYPE_REDUCEDIMAGE    0x1    /* reduced resolution version */
  88. #define        FILETYPE_PAGE        0x2    /* one page of many */
  89. #define        FILETYPE_MASK        0x4    /* transparency mask */
  90. #define    TIFFTAG_OSUBFILETYPE        255    /* +kind of data in subfile */
  91. #define        OFILETYPE_IMAGE        1    /* full resolution image data */
  92. #define        OFILETYPE_REDUCEDIMAGE    2    /* reduced size image data */
  93. #define        OFILETYPE_PAGE        3    /* one page of many */
  94. #define    TIFFTAG_IMAGEWIDTH        256    /* image width in pixels */
  95. #define    TIFFTAG_IMAGELENGTH        257    /* image height in pixels */
  96. #define    TIFFTAG_BITSPERSAMPLE        258    /* bits per channel (sample) */
  97. #define    TIFFTAG_COMPRESSION        259    /* data compression technique */
  98. #define        COMPRESSION_NONE        1    /* dump mode */
  99. #define        COMPRESSION_CCITTRLE    2    /* CCITT modified Huffman RLE */
  100. #define        COMPRESSION_CCITTFAX3    3    /* CCITT Group 3 fax encoding */
  101. #define        COMPRESSION_CCITTFAX4    4    /* CCITT Group 4 fax encoding */
  102. #define        COMPRESSION_LZW        5    /* Lempel-Ziv  & Welch */
  103. #define        COMPRESSION_JPEG        6    /* !JPEG compression */
  104. #define        COMPRESSION_NEXT        32766    /* NeXT 2-bit RLE */
  105. #define        COMPRESSION_CCITTRLEW    32771    /* #1 w/ word alignment */
  106. #define        COMPRESSION_PACKBITS    32773    /* Macintosh RLE */
  107. #define        COMPRESSION_THUNDERSCAN    32809    /* ThunderScan RLE */
  108. #define    TIFFTAG_PHOTOMETRIC        262    /* photometric interpretation */
  109. #define        PHOTOMETRIC_MINISWHITE    0    /* min value is white */
  110. #define        PHOTOMETRIC_MINISBLACK    1    /* min value is black */
  111. #define        PHOTOMETRIC_RGB        2    /* RGB color model */
  112. #define        PHOTOMETRIC_PALETTE        3    /* color map indexed */
  113. #define        PHOTOMETRIC_MASK        4    /* holdout mask */
  114. #define        PHOTOMETRIC_SEPARATED    5    /* !color separations */
  115. #define        PHOTOMETRIC_YCBCR        6    /* !CCIR 601 */
  116. #define        PHOTOMETRIC_DEPTH        32768    /* z-depth data */
  117. #define    TIFFTAG_THRESHHOLDING        263    /* +thresholding used on data */
  118. #define        THRESHHOLD_BILEVEL        1    /* b&w art scan */
  119. #define        THRESHHOLD_HALFTONE        2    /* or dithered scan */
  120. #define        THRESHHOLD_ERRORDIFFUSE    3    /* usually floyd-steinberg */
  121. #define    TIFFTAG_CELLWIDTH        264    /* +dithering matrix width */
  122. #define    TIFFTAG_CELLLENGTH        265    /* +dithering matrix height */
  123. #define    TIFFTAG_FILLORDER        266    /* +data order within a byte */
  124. #define        FILLORDER_MSB2LSB        1    /* most significant -> least */
  125. #define        FILLORDER_LSB2MSB        2    /* least significant -> most */
  126. #define    TIFFTAG_DOCUMENTNAME        269    /* name of doc. image is from */
  127. #define    TIFFTAG_IMAGEDESCRIPTION    270    /* info about image */
  128. #define    TIFFTAG_MAKE            271    /* scanner manufacturer name */
  129. #define    TIFFTAG_MODEL            272    /* scanner model name/number */
  130. #define    TIFFTAG_STRIPOFFSETS        273    /* offsets to data strips */
  131. #define    TIFFTAG_ORIENTATION        274    /* +image orientation */
  132. #define        ORIENTATION_TOPLEFT        1    /* row 0 top, col 0 lhs */
  133. #define        ORIENTATION_TOPRIGHT    2    /* row 0 top, col 0 rhs */
  134. #define        ORIENTATION_BOTRIGHT    3    /* row 0 bottom, col 0 rhs */
  135. #define        ORIENTATION_BOTLEFT        4    /* row 0 bottom, col 0 lhs */
  136. #define        ORIENTATION_LEFTTOP        5    /* row 0 lhs, col 0 top */
  137. #define        ORIENTATION_RIGHTTOP    6    /* row 0 rhs, col 0 top */
  138. #define        ORIENTATION_RIGHTBOT    7    /* row 0 rhs, col 0 bottom */
  139. #define        ORIENTATION_LEFTBOT        8    /* row 0 lhs, col 0 bottom */
  140. #define    TIFFTAG_SAMPLESPERPIXEL        277    /* samples per pixel */
  141. #define    TIFFTAG_ROWSPERSTRIP        278    /* rows per strip of data */
  142. #define    TIFFTAG_STRIPBYTECOUNTS        279    /* bytes counts for strips */
  143. #define    TIFFTAG_MINSAMPLEVALUE        280    /* +minimum sample value */
  144. #define    TIFFTAG_MAXSAMPLEVALUE        281    /* maximum sample value */
  145. #define    TIFFTAG_XRESOLUTION        282    /* pixels/resolution in x */
  146. #define    TIFFTAG_YRESOLUTION        283    /* pixels/resolution in y */
  147. #define    TIFFTAG_PLANARCONFIG        284    /* storage organization */
  148. #define        PLANARCONFIG_CONTIG        1    /* single image plane */
  149. #define        PLANARCONFIG_SEPARATE    2    /* separate planes of data */
  150. #define    TIFFTAG_PAGENAME        285    /* page name image is from */
  151. #define    TIFFTAG_XPOSITION        286    /* x page offset of image lhs */
  152. #define    TIFFTAG_YPOSITION        287    /* y page offset of image lhs */
  153. #define    TIFFTAG_FREEOFFSETS        288    /* +byte offset to free block */
  154. #define    TIFFTAG_FREEBYTECOUNTS        289    /* +sizes of free blocks */
  155. #define    TIFFTAG_GRAYRESPONSEUNIT    290    /* gray scale curve accuracy */
  156. #define        GRAYRESPONSEUNIT_10S    1    /* tenths of a unit */
  157. #define        GRAYRESPONSEUNIT_100S    2    /* hundredths of a unit */
  158. #define        GRAYRESPONSEUNIT_1000S    3    /* thousandths of a unit */
  159. #define        GRAYRESPONSEUNIT_10000S    4    /* ten-thousandths of a unit */
  160. #define        GRAYRESPONSEUNIT_100000S    5    /* hundred-thousandths */
  161. #define    TIFFTAG_GRAYRESPONSECURVE    291    /* gray scale response curve */
  162. #define    TIFFTAG_GROUP3OPTIONS        292    /* 32 flag bits */
  163. #define        GROUP3OPT_2DENCODING    0x1    /* 2-dimensional coding */
  164. #define        GROUP3OPT_UNCOMPRESSED    0x2    /* data not compressed */
  165. #define        GROUP3OPT_FILLBITS        0x4    /* fill to byte boundary */
  166. #define    TIFFTAG_GROUP4OPTIONS        293    /* 32 flag bits */
  167. #define        GROUP4OPT_UNCOMPRESSED    0x2    /* data not compressed */
  168. #define    TIFFTAG_RESOLUTIONUNIT        296    /* units of resolutions */
  169. #define        RESUNIT_NONE        1    /* no meaningful units */
  170. #define        RESUNIT_INCH        2    /* english */
  171. #define        RESUNIT_CENTIMETER        3    /* metric */
  172. #define    TIFFTAG_PAGENUMBER        297    /* page numbers of multi-page */
  173. #define    TIFFTAG_COLORRESPONSEUNIT    300    /* color scale curve accuracy */
  174. #define        COLORRESPONSEUNIT_10S    1    /* tenths of a unit */
  175. #define        COLORRESPONSEUNIT_100S    2    /* hundredths of a unit */
  176. #define        COLORRESPONSEUNIT_1000S    3    /* thousandths of a unit */
  177. #define        COLORRESPONSEUNIT_10000S    4    /* ten-thousandths of a unit */
  178. #define        COLORRESPONSEUNIT_100000S    5    /* hundred-thousandths */
  179. #define    TIFFTAG_TRANSFERFUNCTION    301    /* !colorimetry info */
  180. #define    TIFFTAG_SOFTWARE        305    /* name & release */
  181. #define    TIFFTAG_DATETIME        306    /* creation date and time */
  182. #define    TIFFTAG_ARTIST            315    /* creator of image */
  183. #define    TIFFTAG_HOSTCOMPUTER        316    /* machine where created */
  184. #define    TIFFTAG_PREDICTOR        317    /* prediction scheme w/ LZW */
  185. #define    TIFFTAG_WHITEPOINT        318    /* image white point */
  186. #define    TIFFTAG_PRIMARYCHROMATICITIES    319    /* primary chromaticities */
  187. #define    TIFFTAG_COLORMAP        320    /* RGB map for pallette image */
  188. #define    TIFFTAG_HALFTONEHINTS        321    /* !highlight+shadow info */
  189. #define    TIFFTAG_TILEWIDTH        322    /* !rows/data tile */
  190. #define    TIFFTAG_TILELENGTH        323    /* !cols/data tile */
  191. #define TIFFTAG_TILEOFFSETS        324    /* !offsets to data tiles */
  192. #define TIFFTAG_TILEBYTECOUNTS        325    /* !byte counts for tiles */
  193. #define    TIFFTAG_BADFAXLINES        326    /* lines w/ wrong pixel count */
  194. #define    TIFFTAG_CLEANFAXDATA        327    /* regenerated line info */
  195. #define        CLEANFAXDATA_CLEAN        0    /* no errors detected */
  196. #define        CLEANFAXDATA_REGENERATED    1    /* receiver regenerated lines */
  197. #define        CLEANFAXDATA_UNCLEAN    2    /* uncorrected errors exist */
  198. #define    TIFFTAG_CONSECUTIVEBADFAXLINES    328    /* max consecutive bad lines */
  199. #define    TIFFTAG_INKSET            332    /* !inks in separated image */
  200. #define        INKSET_CMYK            1    /* !cyan-magenta-yellow-black */
  201. #define    TIFFTAG_INKNAMES        333    /* !ascii names of inks */
  202. #define    TIFFTAG_DOTRANGE        336    /* !0% and 100% dot codes */
  203. #define    TIFFTAG_TARGETPRINTER        337    /* !separation target */
  204. #define    TIFFTAG_JPEGPROC        512    /* !JPEG processing algorithm */
  205. #define        JPEGPROC_BASELINE        0    /* !baseline sequential */
  206. #define        JPEGPROC_LOSSLESS        14    /* !Huffman coded lossless */
  207. #define    TIFFTAG_JPEGIFOFFSET        513    /* !pointer to SOI marker */
  208. #define    TIFFTAG_JPEGIFBYTECOUNT        514    /* !JFIF stream length */
  209. #define    TIFFTAG_JPEGRESTARTINTERVAL    515    /* !restart interval length */
  210. #define    TIFFTAG_JPEGLOSSLESSPREDICTORS    517    /* !lossless proc predictor */
  211. #define    TIFFTAG_JPEGPOINTTRANSFORM    518    /* !lossless point transform */
  212. #define    TIFFTAG_JPEGQTABLES        519    /* !Q matrice offsets */
  213. #define    TIFFTAG_JPEGDCTABLES        520    /* !DCT table offsets */
  214. #define    TIFFTAG_JPEGACTABLES        521    /* !AC coefficient offsets */
  215. #define    TIFFTAG_YCBCRCOEFFICIENTS    529    /* !RGB -> YCbCr transform */
  216. #define    TIFFTAG_YCBCRSUBSAMPLING    530    /* !YCbCr subsampling factors */
  217. #define    TIFFTAG_YCBCRPOSITIONING    531    /* !subsample positioning */
  218. #define        YCBCRPOSITION_CENTERED    1    /* !as in PostScript Level 2 */
  219. #define        YCBCRPOSITION_COSITED    2    /* !as in CCIR 601-1 */
  220. #define    TIFFTAG_REFERENCEBLACKWHITE    532    /* !colorimetry info */
  221. /* tags 32995-32999 are private tags registered to SGI */
  222. #define    TIFFTAG_MATTEING        32995    /* alpha channel is present */
  223. #define    TIFFTAG_DATATYPE        32996    /* how to interpret data */
  224. #define        DATATYPE_VOID        0    /* untyped data */
  225. #define        DATATYPE_INT        1    /* signed integer data */
  226. #define        DATATYPE_UINT        2    /* unsigned integer data */
  227. #define        DATATYPE_IEEEFP        3    /* IEEE floating point data */
  228. #define    TIFFTAG_IMAGEDEPTH        32997    /* z depth of image */
  229. #define    TIFFTAG_TILEDEPTH        32998    /* z depth/data tile */
  230. #endif /* _TIFF_ */
  231.